<template>
  <div>
    <h2>用户信息</h2>
    <el-card>
      <p>用户名: {{ user.name }}</p>
      <p>邮箱: {{ user.email }}</p>
    </el-card>
    <el-divider></el-divider>
    <h3>收藏的餐厅</h3>
    <el-list>
      <el-list-item v-for="restaurant in user.favorites" :key="restaurant.id">
        {{ restaurant.name }}
      </el-list-item>
    </el-list>
    <el-divider></el-divider>
    <h3>历史操作记录</h3>
    <el-timeline>
      <el-timeline-item v-for="record in user.history" :key="record.id">
        {{ record.action }} - {{ record.time }}
      </el-timeline-item>
    </el-timeline>
  </div>
</template>

<script>
export default {
  name: 'UserProfilePage',
  data() {
    return {
      user: {
        name: '小仓梦',
        email: '2074903565@qq.com',
        favorites: [
          { id: 1, name: '麦当劳' },
          { id: 2, name: '椒麻鸡火锅' },
        ],
        history: [
          { id: 1, action: '评论了餐厅', time: '2024-11-01' },
          { id: 2, action: '收藏了餐厅', time: '2024-11-05' },
        ],
      },
    };
  },
};
</script>

